<?php

namespace Liuhelong\LaravelAdmin\Wechat\Http\Controllers;

use Encore\Admin\Controllers\AdminController;
use Encore\Admin\Form;
use Encore\Admin\Grid;
use Encore\Admin\Show;
use \Liuhelong\LaravelAdmin\Wechat\Models\WechatOffiaccountUser;

class WechatOffiaccountUserController extends AdminController
{
    /**
     * Title for current resource.
     *
     * @var string
     */
    protected $title = '公众号用户（接口变更，部分字段不再能显示）';

    /**
     * Make a grid builder.
     *
     * @return Grid
     */
    protected function grid()
    {
        $grid = new Grid(new WechatOffiaccountUser());
		
		$grid->column('subscribe', __('laravel_admin_wechat.Subscribe'))->bool();
		$grid->column('headimgurl',__('laravel_admin_wechat.Avatar') )->image('',100,100);
		$grid->column('nickname', __('laravel_admin_wechat.Nickname'));
		$grid->column('language', __('laravel_admin_wechat.Language'));
		$grid->column('country', __('laravel_admin_wechat.Country'));
		$grid->column('province', __('laravel_admin_wechat.Province'));
		$grid->column('city', __('laravel_admin_wechat.City'));
		$grid->column('subscribe_time', __('laravel_admin_wechat.Subscribe time'));
		$grid->column('remark', __('laravel_admin_wechat.Remark'));
		$grid->column('subscribe_scene',__('laravel_admin_wechat.Subscribe scene'))->using([
			'ADD_SCENE_SEARCH' => '公众号搜索',
			'ADD_SCENE_ACCOUNT_MIGRATION' => '公众号迁移',
			'ADD_SCENE_PROFILE_CARD' => '名片分享',
			'ADD_SCENE_QR_CODE' => '扫描二维码',
			'ADD_SCENE_PROFILE_LINK' => '图文页内名称点击',
			'ADD_SCENE_PROFILE_ITEM' => '图文页右上角菜单',
			'ADD_SCENE_PAID' => '支付后关注',
			'ADD_SCENE_WECHAT_ADVERTISEMENT' => '微信广告',
			'ADD_SCENE_OTHERS' => '其他',
		]);
		$grid->column('unionid', __('laravel_admin_wechat.Unionid'))->hide();
		$grid->column('openid', __('laravel_admin_wechat.Openid'));
		$grid->column('groupid',__('laravel_admin_wechat.Groupid') )->hide();
		$grid->column('tagid_list',__('laravel_admin_wechat.Tagid list'))->hide();
		$grid->column('qr_scene', __('laravel_admin_wechat.Qr scene'))->hide();
		$grid->column('qr_scene_str',__('laravel_admin_wechat.Qr scene str'))->hide();

		$grid->actions(function (Grid\Displayers\Actions $actions) {
            $actions->disableView();
            $actions->disableEdit();
			$actions->disableDelete();
			
			$actions->add(new \Liuhelong\LaravelAdmin\Wechat\Actions\WechatOffiaccountUser\Remark);
			
			
        });

        return $grid;
    }

    /**
     * Make a show builder.
     *
     * @param mixed $id
     * @return Show
     */
    protected function detail($id)
    {
        $show = new Show(WechatOffiaccountUser::findOrFail($id));



        return $show;
    }

    /**
     * Make a form builder.
     *
     * @return Form
     */
    protected function form()
    {
        $form = new Form(new WechatOffiaccountUser());



        return $form;
    }
}
